﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpaceNeedle.City6473.Web.Data.Models
{
    //[MetadataType(typeof(UsersAuthenticationMetaData))]
    public partial class UsersAuthentication
    {
        public bool IsAdmin(string adminRole)
        {
            return this.Roles == adminRole;
        }
    }

    public class UsersAuthenticationMetaData
    {
        [Required(ErrorMessage = "*")]
        [StringLength(50, ErrorMessage = "No máximo '{1}' caracteres.")]
        public string Name { get; set; }

        [Required(ErrorMessage = "*")]
        [StringLength(255, ErrorMessage = "No máximo '{1}' caracteres.")]
        //[EmailAddress(ErrorMessage = "E-mail inválido")]
        public string Email { get; set; }

        //[Required(ErrorMessage = "*")]
        //[StringLength(16, ErrorMessage = "No máximo '{1}' caracteres.")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Required(ErrorMessage = "*")]
        [StringLength(50, ErrorMessage = "No máximo '{1}' caracteres.")]
        public string Roles { get; set; }

    }
}
